package com.bw.coll;

import com.bw.bean.Emp;
import com.bw.bean.Emp1;
import com.bw.service.EmpService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class EmpColl {

    @Autowired
    EmpService emp;

    @RequestMapping("/list1")
    public  Map getList1(){
        List<Emp> list1 = emp.getList1();
        return SugarUtil.getBarData(list1);
    }

    @RequestMapping("/list2")
    public Map getList2(){
        List<Emp1> list2 = emp.getList2();
        ArrayList<String> list = new ArrayList<>();
        list.add("题目内容");
        list.add("答题次数");
        list.add("正确答题");
        list.add("正确率");
        return SugarUtil.getTablePlayData(list,list2);
    }

    @RequestMapping("/list3")
    public Map getList3(){
        List<Emp1> list3 = emp.getList3();
        ArrayList<String> list = new ArrayList<>();
        list.add("试卷名称");
        list.add("考试人次");
        list.add("平均分");
        list.add("平均用时");
        return SugarUtil.getTablePlayData(list,list3);
    }

    @RequestMapping("/list4")
    public Map getList4(){
        List<Emp> list4 = emp.getList4();
        return SugarUtil.getBarData(list4);
    }


}
